#include "i2c.h"
#include "types.h"

#include <stdio.h>
#include <string.h>


int I2C_example() {
	unsigned char buf;
	
	/* open device with high speed mode */
	I2C_open(I2C_HIGHSPEED_MODE);
	
	/* I2C [START] signal */
	I2C_start();
	
	/* write 0xAA */
	I2C_write_byte(0xAA);
	
	/* read without last [ACK] */
	buf = I2C_read_byte(FALSE);
	I2C_write_byte(buf);
	
	/* I2C [STOP] signal */
	I2C_stop();
	
	/* close device */
	I2C_close();
	return 0;
}
